﻿#region Using

using System;
using Vk.Methods.Common;

#endregion

namespace Vk.Methods.Photos
{
    public class PhotoEntryFull : BaseEntity
    {
        /*
         * <photo>
          <pid>146771291</pid>
          <aid>100001227</aid>
          <owner_id>6492</owner_id>
          <src>http://cs9231.vkontakte.ru/u06492/100001227/m_7875d2fb.jpg</src>
          <src_big>http://cs9231.vkontakte.ru/u06492/100001227/x_cd563004.jpg</src_big>
          <src_small>http://cs9231.vkontakte.ru/u06492/100001227/s_c3bba2a8.jpg</src_small>
          <src_xbig>http://cs9231.vkontakte.ru/u06492/100001227/y_62a74569.jpg</src_xbig>
          <src_xxbig>http://cs9231.vkontakte.ru/u06492/100001227/z_793e9682.jpg</src_xxbig>
          <text>test</text>
          <created>1260885741</created>
         </photo>
         */
        public int? AlbumId;
        public DateTime? DateCreated;
        public bool Extended;
        public string Text;
        public string Url;
        public string UrlBig;
        public string UrlSmall;
        public string UrlXBig;
        public string UrlXXBig;

        public PhotoEntryFull(ApiNode node)
        {
            Id = node.Int("pid");
            AlbumId = node.Int("aid");
            OwnerId = node.Int("owner_id");
            Url = node.String("src");
            UrlBig = node.String("src_big");
            UrlSmall = node.String("src_small");
            UrlXBig = node.String("src_xbig");
            UrlXXBig = node.String("src_xxbig");
            Text = node.String("text");
            DateCreated = node.DateTime("created");
        }

        public override string ToString()
        {
            return Text;
        }
    }

    public class PhotoEntryFullExtended : PhotoEntryFull
    {
        public int? CommentsCount;
        public LikesInfo LikesInfo;
        public int? TagsCount;

        public PhotoEntryFullExtended(ApiNode node) : base(node)
        {
            CommentsCount = node.Int("comments/count");
            TagsCount = node.Int("tags/count");

            LikesInfo = new LikesInfo(node.SelectNode("likes"));

            Extended = true;
        }
    }

    public class PhotoEntryFullTagInfo : PhotoEntryFull
    {
        public int? PlacerId;
        public DateTime? TagCreated;
        public int? TagId;

        public PhotoEntryFullTagInfo(ApiNode node) : base(node)
        {
            TagId = node.Int("tag_id");
            PlacerId = node.Int("placer_id");
            TagCreated = node.DateTime("tag_created");
        }
    }
}